#!/bin/bash

flutter clean


#rm -r .ideas
rm -rf  build .dart_tool .flutter-plugins .flutter-plugins-dependencies pubspec.lock

#remove about iso file
rm -rf  ios/.symlinks ios/Pods ios/Podfile.lock

#remove about android file
#rm -rf android/.idea
rm -rf  android/.gradle android/gradlew android/gradlew.bat android/local.properties

#remove about macos file
rm -rf  macos/Pods macos/Podfile.lock

#remove about *.g.dart file
find lib/api_entity -type f -name "*.g.dart" -exec rm -f {} +

## if open this command will push or commit to git have some error
#find .git/objects -mindepth 1 ! \( -name 'info' -o -name 'pack' \) -delete


time=$(date "+%Y%m%d_%H%M%S")
content=$(grep  "name:" pubspec.yaml | head -n 1)
name=$(echo "$content" | sed 's/name: //g')
#zip -r ${name}_${time}.zip .

find . -type f ! \( -name '*.zip' -o -name '*.apk' \) -exec zip -r ${name}_${time}.zip {} +